package com.gitee.xmhzzz.component.openfeign.customized;

import org.springframework.cloud.openfeign.FeignFormatterRegistrar;
import org.springframework.format.FormatterRegistry;
import org.springframework.format.datetime.DateFormatter;

import java.util.TimeZone;

public class FeignDateFormatterRegistrar implements FeignFormatterRegistrar
{
    private static final String DATE_PATTERN = "yyyy-MM-dd HH:mm:ss,SSS";
    
    @Override
    public void registerFormatters(FormatterRegistry registry)
    {
        DateFormatter dateFormatter = new DateFormatter(DATE_PATTERN);
        dateFormatter.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
        registry.addFormatter(dateFormatter);
    }

}
